<?php

namespace app\common\models;

class SysConfig extends BaseModel
{
    protected $name = 'config';

    public function getActivityInfo($inside = false)
    {
        $config_list = $this->getList(['group'=>'qq_activity']);
        $data_list = [];
        if (!empty($config_list)){
            foreach ($config_list as $val){
                if ($val['type'] == 'array'){
                    $val['value'] = json_decode($val['value'], true);
                }
                $data_list[$val['name']] = $val['value'];
            }
        }
        if (!$inside){
            unset($data_list['common_share']);
            unset($data_list['activity_number']);
            // 获取广告数据
            // TODO::需要在后台定义规则后调整参数
            $ads_model = new Ads();
            $ads_model::fields(['link,position', true]);
            $data_list['top_ad'] = $ads_model->getList(['position'=>'index_lb']);
            $data_list['bottom_ad'] = $ads_model->getList(['position'=>'index_jx2']);
        }
        return $data_list;
    }

    public function topUPVerify($money, $user_id, $type)
    {

    }

}